
* this do file pulls and combines SSDR data

cd "M:\Massachusetts\data_raw\saves\SSDR"

use "sims_susp_2004-2012", clear

rename inschsusp_sum  inschsus_sum
rename outschsusp_sum outschsus_sum
rename susp_sum day_suspension

label var inschsus_sum "# In-School Suspension Incidents"
label var outschsus_sum "# Out-of-School Suspension Incidents"
label var day_suspension "# Total Suspension Days"

tempfile temp2012
save `temp2012'

foreach num in 13 14 15 16 17 18 19 20 21 22 23 {
	use "ssdr`num'", clear
	g year = 20`num'
	tempfile temp20`num'
	save `temp20`num''
}

use `temp2012', clear

foreach num in 13 14 15 16 17 18 19 20 21 22 23 {
	append using `temp20`num''
}

keep sasid year outschsus_sum inschsus_sum day_suspension

replace day_suspension = . if day_suspension < 0
replace outschsus_sum = . if outschsus_sum < 0
replace inschsus_sum = . if inschsus_sum < 0

save "M:\Massachusetts\data_raw\saves\SSDR\ssdr", replace

reshape wide day_suspension outschsus_sum inschsus_sum, i(sasid) j(year)

*collapse (sum) day_suspension outschsus_sum inschsus_sum , by(sasid)

save "M:\Massachusetts\data_clean\ssdr_wide", replace
